window.onload = function(){
	var none = document.querySelector (".pop i");
	var inp = document.querySelector(".pop-up input");
	
	inp.onclick = none.onclick = function(){
		document.querySelector(".pop").style.display = "none";
	}
	
	var num = ['','一','二','三','四','五','六','七','八','九']
	var mul = ['','十','百'];
	
	var seat = document.getElementsByClassName("seat")[0];
	var branch = document.getElementsByClassName("branch");
	var add = document.querySelector(".add");
	add.onclick = function (){
		var tem = branch[1].cloneNode(true);
		var numb ;
		if (branch.length<10) {
			tem.querySelector("p").innerHTML ="第"+num[branch.length]+"桌";
			
		} else if (branch.length<100) {
			numb=branch.length%10;
			tem.querySelector("p").innerHTML ="第"+num[Number(branch.length.toString()[0])]+"十"+num[numb]+"桌";
		}
		seat.insertBefore(tem,branch[branch.length-1]);
		big();
		console.log(tem.innerHTML)
	}
	
	
	function big(){
		var main = document.getElementsByClassName("main");
		for (var i = 0;i < main.length-1; i++) {
			console.log("adf")
			main[i].index =i;
			main[i].addEventListener("click",function(){
				for (var j = 0;j < main.length; j++) {
					main[j].parentNode.style.display = "none";
				}
				this.parentNode.style.cssText = "width: 100%;display: block;height: 475px;";
				if (this.index == 0) {
					this.style.transform = "scale(2.0) translateY(80px)";
				} else{
					this.style.transform = "scale(2.9) translateY(50px)";
				}
				
				
			})
			
		}
		
	}
	
	big();
	
	
	
	
}
